var teacherConfigId;
function btnSubmit(param){
    if(param == "save"){
        var formdata = $("#frm_main").serializeObject();

        formdata.id=teacherConfigId;
        // console.log(formdata);
        server.req('wechat/teacherconfig/update',formdata,function (e) {
            if(e.code==0){
                pop_up("保存成功");
            }else {
                pop_up("保存失败");
            }
            server.loadindex('page/teacher/teacherindex/teacherindex');
        },null,"POST");


    }else if(param == "cancel"){
        server.loadindex('page/teacher/teacherindex/teacherindex');
    }
};
//获取当前用户的大师资格申请
server.req('wechat/teacher/getByMemberId',{},function (e) {
    if(e.code==0){
        // console.log(e);
        var data = e.data;
        if(e.data==null){
            console.log("你没通过专家审核");
        }
        else{
            if(data.status==2){
                server.loadData(".content-body",data);
            }else{
                console.log("你没通过专家审核");
            }
        }
    }
});
//获取当前用户的专家配置记录
server.req('wechat/teacherconfig/getCurrentTeacherConfig',{},function (res) {

    if(res.code == 0){
        var config = res.data;
        // console.log(config);
        teacherConfigId = config.id;
        server.loadData(".content-body",config);
    }
})

